/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Client.gui;

import Client.domain.ClientDomainController;

/**
 *
 * @author Ripper
 */
public class GameLobbyPanelUpdater implements Runnable
{
    private GameLobbyPanel geelp;
    private ClientDomainController cdc;
    
    private boolean running;
    
    public GameLobbyPanelUpdater(GameLobbyPanel glp, ClientDomainController ceedcee)
    {
        geelp = glp;
        cdc = ceedcee;
        
        running = true;
    }
    
    @Override
    public void run()
    {
        
        while(running)
        {
            String reply = cdc.askTheServer("getsessionlobbydata");
            try
            {
                geelp.provideData(reply);
            }
            catch(Exception ex) {}
            
            try
            {
                Thread.sleep(200);
            }catch(Exception ex){ }
        }
    }
    
    public void stopRunning()
    {
        running = false;
    }
    public boolean isRunning()
    {
        return running;
    }
}
